Skip to content

feat: tell data channel observers when the buffered amount is low - #605

Open
devopvoid wants to merge 1 commit into
mainfrom
feat/data-channel-buffered-amount-low
Open

devopvoid wants to merge 1 commit into
mainfrom
feat/data-channel-buffered-amount-low

Conversation

@devopvoid

Copy link
Copy Markdown
Owner

Description

  • RTCDataChannel.setBufferedAmountLowThreshold(long) sets the threshold, 0 by default.
  • RTCDataChannelObserver.onBufferedAmountLow(), a default method, is called once the buffered amount falls from above the threshold to it or below.

The channel counts the buffered amount itself, raised by every send and lowered by every decrease the observer hears of, as browsers do. The native value, read on the observer's thread, has often fallen further by then and would hide where an event crossed the threshold.

Motivation and Context

A sender of much data can keep the buffer between a low and a high mark and send more as soon as there is room, without polling getBufferedAmount().

Type of Change

  • New feature (feat)

Affected Modules

  • webrtc (Java API)
  • webrtc-jni (native code)
  • docs

Notes for Reviewers

The SCTP transport PR adds a helper at the same place in TestDataChannelPair; whichever merges second keeps both methods.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant